/*
 ============================================================================
 Name		: FEEditor.h
 Author	  : shangguan
 Version	 : 1.0
 Copyright   : this class for file open and save
 Description : CFEEditor declaration
 ============================================================================
 */

#ifndef FEEDITOR_H
#define FEEDITOR_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <f32file.h> 
#include <s32file.h>

// CLASS DECLARATION

/**
 *  CFEEditor
 * 
 */
class CFEEditor : public CBase
{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CFEEditor();

	/**
	 * Two-phased constructor.
	 */
	static CFEEditor* NewL();

	/**
	 * Two-phased constructor.
	 */
	static CFEEditor* NewLC();

private:

	/**
	 * Constructor for performing 1st stage construction
	 */
	CFEEditor();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL();
public:
	TBool CreateFile(TFileName aFn);
	void OpenL(TFileName aFn, TDes &aDes);
	void SaveL(TFileName aFn, const TDes &aDes);
	void SaveAsL(TFileName aFn, const TDes &aDes);

protected:
	void RunL();
	void DoCancel();

private:
	RFs &iFs;
	RFile iFile;
	RFileWriteStream iFw;
	RFileReadStream iFr;

};

#endif // FEEDITOR_H
